package com.coderman.basketball.infrast.gatawayimpl.activity;

import com.coderman.basketball.domain.gataway.activity.SignUpService;
import com.coderman.basketball.domain.model.activity.SignUpRecordBO;
import com.coderman.basketball.infrast.converter.activity.SignUpRecordConverter;
import com.coderman.basketball.infrast.converter.member.PlayerConverter;
import com.coderman.basketball.infrast.dao.dataobject.activity.SignUpRecordDO;
import com.coderman.basketball.infrast.dao.mapper.activity.SignUpRecordMapper;
import com.coderman.basketball.infrast.dao.mapper.member.PlayerMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description:
 * date: 2021/5/18
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Service
public class SignUpServiceImpl implements SignUpService {

    @Resource
    private SignUpRecordMapper signUpRecordMapper;

    @Resource
    private PlayerMapper playerMapper;

    @Override
    public void signUp(SignUpRecordBO signUpBO) {
        long id = playerMapper.insert(PlayerConverter.INSTANCE.bo2do(signUpBO.getPlayerBO()));
        SignUpRecordDO signUpRecordDO = SignUpRecordConverter.INSTANCE.bo2do(signUpBO);
        signUpRecordDO.setPlayerId(id);
        signUpRecordMapper.insert(signUpRecordDO);
    }
}
